Namespaces

Types in FluentNHibernate.Mapping

Type CompositeIdentityPart<T>

Namespace FluentNHibernate.Mapping

Interfaces ICompositeIdMappingProvider

Methods

Properties

Public instance methods

CompositeIdentityPart<T> ComponentCompositeIdentifier<TComponentType>(Expression<Func<T, TComponentType>> expression)

You may use a component as an identifier of an entity class. Your component class must satisfy certain requirements: * It must be Serializable. * It must re-implement Equals() and GetHashCode(), consistently with the database's notion of composite key equality. You can't use an IIdentifierGenerator to generate composite keys. Instead the application must assign its own identifiers. Since a composite identifier must be assigned to the object before saving it, we can't use unsaved-value of the identifier to distinguish between newly instantiated instances and instances saved in a previous session. You may instead implement IInterceptor.IsUnsaved() if you wish to use SaveOrUpdate() or cascading save / update. As an alternative, you may also set the unsaved-value attribute on a version or timestamp to specify a value that indicates a new transient instance. In this case, the version of the entity is used instead of the (assigned) identifier and you don't have to implement IInterceptor.IsUnsaved() yourself.
Your persistent class must override Equals() and GetHashCode() to implement composite identifier equality. It must also be Serializable.
Parameters
Expression<Func<T, TComponentType>> expression

The property of component type that holds the composite identifier.

CompositeIdentityPart<T> KeyProperty(Expression<Func<T, object>> expression)

Defines a property to be used as a key for this composite-id.
Parameters
Expression<Func<T, object>> expression

A member access lambda expression for the property

Return
CompositeIdentityPart<T>

The composite identity part fluent interface

CompositeIdentityPart<T> KeyProperty(Expression<Func<T, object>> expression, Action<KeyPropertyPart> keyPropertyAction)

Defines a property to be used as a key for this composite-id with an explicit column name.
Parameters
Expression<Func<T, object>> expression

A member access lambda expression for the property

Action<KeyPropertyPart> keyPropertyAction

Additional settings for the key property

Return
CompositeIdentityPart<T>

The composite identity part fluent interface

CompositeIdentityPart<T> KeyProperty(Expression<Func<T, object>> expression, string columnName)

Defines a property to be used as a key for this composite-id with an explicit column name.
Parameters
Expression<Func<T, object>> expression

A member access lambda expression for the property

string columnName

The column name in the database to use for this key, or null to use the property name

Return
CompositeIdentityPart<T>

The composite identity part fluent interface

CompositeIdentityPart<T> KeyReference(Expression<Func<T, object>> expression, String[] columnNames)

Defines a reference to be used as a many-to-one key for this composite-id with an explicit column name.
Parameters
Expression<Func<T, object>> expression

A member access lambda expression for the property

String[] columnNames

A list of column names used for this key

Return
CompositeIdentityPart<T>

The composite identity part fluent interface

CompositeIdentityPart<T> KeyReference(Expression<Func<T, object>> expression, Action<KeyManyToOnePart> customMapping, String[] columnNames)

Defines a reference to be used as a many-to-one key for this composite-id with an explicit column name.
Parameters
Expression<Func<T, object>> expression

A member access lambda expression for the property

Action<KeyManyToOnePart> customMapping

A lambda expression specifying additional settings for the key reference

String[] columnNames

A list of column names used for this key

Return
CompositeIdentityPart<T>

The composite identity part fluent interface

CompositeIdentityPart<T> KeyReference(Expression<Func<T, object>> expression)

Defines a reference to be used as a many-to-one key for this composite-id with an explicit column name.
Parameters
Expression<Func<T, object>> expression

A member access lambda expression for the property

Return
CompositeIdentityPart<T>

The composite identity part fluent interface

CompositeIdentityPart<T> Mapped()

Specifies that this composite id is "mapped"; aka, a composite id where the properties exist in the identity class as well as in the entity itself

CompositeIdentityPart<T> UnsavedValue(string value)

Specifies the unsaved value for the identity
Parameters
string value

Unsaved value

Public properties

AccessStrategyBuilder<T> Access get;

Set the access and naming strategy for this identity.

CompositeIdentityPart<T> Not get;

Invert the next boolean operation